﻿using System;
using NUnit.Framework;
using Rhino.Mocks;

using ServiceManager;


namespace Test_ServiceManager
{
    [TestFixture]
    public class Test_ScheduledServiceTask
    {
        private Service service;

        [SetUp]
        public void Setup()
        {
            this.service = new Service("Test_Service", ServiceStatus.Started);
        }

        [Test]
        public void Test_ScheduledServiceTask_Constructor()
        {
            DateTime scheduledTime = new DateTime(2010,2,2,12,30,01);
            ScheduledServiceTask scheduledServiceTask = new ScheduledServiceTask(service, CommandType.StartService, scheduledTime);

            Assert.IsNotNull(scheduledServiceTask.Service);
            Assert.AreEqual(CommandType.StartService, scheduledServiceTask.CommandType);
            Assert.AreEqual(TaskType.Scheduled, scheduledServiceTask.TaskType);
            Assert.AreEqual(TaskStatus.Pending, scheduledServiceTask.TaskStatus);
            Assert.AreEqual(scheduledTime, scheduledServiceTask.DateTime);
        }


        [Test]
        public void Test_ScheduledServiceTask_DateTime()
        {
            DateTime scheduledTime = DateTime.Today.AddMinutes(1);
            ScheduledServiceTask scheduledServiceTask = new ScheduledServiceTask(service, CommandType.StartService, scheduledTime);
            Assert.AreEqual(scheduledTime, scheduledServiceTask.DateTime);
        }

    }
}
